package com.ghostflying.wlanassistant;

import java.util.HashMap;
import java.util.Map;

import android.app.Service;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.wifi.WifiManager;
import android.os.IBinder;
import android.util.Log;

public class ZJUWLANAutoLoginService extends Service {
	private final String TAG = "AutoLogin Service";
	private WifiManager mWifiManager = null;

	@Override
	public IBinder onBind(Intent arg0) {
		// TODO Auto-generated method stub
		return null;
	}
	
	@Override
    public void onCreate() {
        super.onCreate();
        mWifiManager = (WifiManager) getSystemService(MainActivity.WIFI_SERVICE);
    }
	@Override
    public void onDestroy() {
        super.onDestroy();
        Log.d(TAG, "Service Stoped");
    }
	
	@Override
	public int onStartCommand(Intent intent, int flags, int startId){
		
		return startId;		
	}
	
	private class LoginThread extends Thread{
		String username;
		String password;
		Boolean forceLogin;
		
		public void run(){
			SharedPreferences  setting = getSharedPreferences(WifiAutoLoginFragment.PARAM_STORE, MainActivity.MODE_PRIVATE);
			username = setting.getString("USERNAME", "");
			password = setting.getString("PASSWORD", "");
			forceLogin = setting.getBoolean("FORCELOGIN", false);	
			
			if (!username.equals("")){
				Map<String, String> data = new HashMap<String, String>();
				data.put("action", "login");
				data.put("username", username);
				data.put("password", password);
				data.put("ac_id", "5");
				data.put("is_ldap", "1");
				data.put("type", "2");
				data.put("local_auth", "1");
			}
		}
	}

}
